package mbp.gui.frames;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.border.EmptyBorder;
import javax.swing.border.TitledBorder;

import mbp.core.Offer;
import mbp.gui.panels.OfferDetailsPanel;
import mbp.gui.panels.OfferInfoPanel;

public class OfferEditor extends JFrame {

	private JPanel contentPane;
	private OfferInfoPanel offerInfoPanel;
	private OfferDetailsPanel offerDetailsPanel;

	/**
	 * Create the frame.
	 */
	public OfferEditor(Offer offer) 
	{
		this.setTitle("Offer for service type: " + offer.getType().getServiceTypeName() + " from: " + offer.getServerName());
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setBounds(100, 100, 709, 457);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		offerInfoPanel = new OfferInfoPanel();
		offerInfoPanel.setBounds(10, 11, 674, 122);
		offerInfoPanel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Offer info", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
		contentPane.add(offerInfoPanel);
		
		offerDetailsPanel = new OfferDetailsPanel();
		offerDetailsPanel.setBounds(10, 144, 676, 246);
		offerDetailsPanel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Offer details", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
		contentPane.add(offerDetailsPanel);
		
		offerInfoPanel.loadOfferInfo(offer);
		offerDetailsPanel.loadOffer(offer);
	}

}
